package com.gupao.alg.alg102;

public class FrogJump {
    /**
     * 青蛙跳
     *
     * @param args
     */
    public static int count = 0;

    public static void main(String[] args) {
        System.out.println(f(31));
        System.out.println("count" + count);

    }

    public static int f(int n) {
        count++;
        //f(0) = 0,f(1) = 1，等价于 n<=2时，f(n) = n。
        if (n <= 2) {
            return n;
        }
        return f(n - 1) + f(n - 2);
    }
}
